package Entities;

import Visitor.IVisitor;

public class Bar implements Entities.Drawable {

    private double x;
    private double y;
    private double width;
    private double height;
    private BarSize size;
    private int id;

    public Bar(float x, float y) {
        this.x = x;
        this.y = y;
        width = 59;
        height = 13;
        size = BarSize.NORMAL;
    }

    @Override
    public Drawable accept(IVisitor visitor) {
        return visitor.visit(this);
    }

    @Override
    public void addChild(Drawable drawable) {
    }

    @Override
    public void remove(Drawable drawable) {
    }

    @Override
    public Drawable getChild(int pos) {
        return null;
    }

    @Override
    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    @Override
    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public double getWidth() {
        if (size.equals(BarSize.SMALL)) {
            return width - 10;
        } else if (size.equals(BarSize.NORMAL)) {
            return width;
        } else if (size.equals(BarSize.HIGH)) {
            return width + 10;
        }
        return 0;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        if (size.equals(BarSize.SMALL)) {
            return height - 2;
        } else if (size.equals(BarSize.NORMAL)) {
            return height;
        } else if (size.equals(BarSize.HIGH)) {
            return height + 2;
        }
        return 0;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    @Override
    public int getNumElems() {
        return 0;
    }

    @Override
    public int getId() {
        return id;
    }

    @Override
    public void setId(int id) {
        this.id = id;
    }

    public BarSize getSize() {
        return size;
    }

    public void setSize(BarSize size) {
        this.size = size;
    }
}
